import { CheckCardGroupProps } from '@ant-design/pro-components'
import { useState } from 'react'
export type CheckCardValueType = string | number | boolean;
export type CheckGroupValueType = CheckCardValueType[] | CheckCardValueType | undefined;
export function useCheckCard(defValue: CheckGroupValueType, items: CheckCardGroupProps['options']): {
    props: CheckCardGroupProps,
    setItems: (items: CheckCardGroupProps['options']) => void
} {
    const [value, setValue] = useState<CheckGroupValueType>(defValue)
    const [options, setOptions] = useState<CheckCardGroupProps['options']>(items)
    const props: CheckCardGroupProps = {
        onChange: e => {
            setValue(e)
        },
        value: value,
        options: options
    }
    return {
        props,
        setItems: setOptions
    }
}